<style type="text/css">
	#content p.title-list-exercises{
		margin:10px 0px 0px 5px;
		font-weight:bold;
		font-size:1.4em;	
	}

	div.components-news{
		width:99%;
		padding-top:5px;
		margin:0px 20px 0px 5px;
		padding-bottom:10px;
		
		clear: both;

	}
	div.components-news img{
		border:1px solid #ddd;
		padding:1px;
		float:left;
		margin-right: 10px;
	}
	div.components-news p.title-news{
		font-size:1.2em;
		font-weight: bold;
		text-decoration: underline;
		margin-bottom:5px;		
	}
	div.components-news p.title-news a{
		color:black;

	}
	
	#add-exercises{
		float:right;
		margin-right:5px;
}
	
</style>

<script>
  function deleteEx(id){
    var comfirmBox;
      var domain = $("#domain").val();
     comfirmBox = confirm("Bạn có chác chắn muốn xóa không ?");
     if(comfirmBox == true)
      {
       $.ajax(
              {
                type:"POST",
              url: domain + "/subjects/delete-ex",
              data: "id=" + id,
              datatype: "html",
              success: function(html)
                 {
                $("#row" + id).remove();
                 }
              }
              );
      }
  }
</script>
<input type="hidden" value="<?php echo DOMAIN_INDEX ?>" id="domain">
 <div id="content">
 	 <?php 
 	 	$sj_name = $this->sj_name; 
 	 	$sj_id = $this->sj_id;	
 	 ?>
     <section class="grid_9" id="dashtabs" style="width:98%;min-height:400px;">
     <p class="title-list-exercises">Danh sách bài tập môn <?php echo $sj_name ?> <a style="float:right;" href="<?php echo DOMAIN_INDEX ?>/subjects/score-subject?sj_id=<?php echo $sj_id; ?>">Chấm điểm</a></p>
     <span id="add-exercises"><a href="<?php echo DOMAIN_INDEX ?>/subjects/add-exercises?sj_id=<?php echo $sj_id; ?>">Thêm bài tập</a></span>
	<?php 
			$list = $this->list;
		//	Zend_Debug::dump($list);die;
			if(count($list)){
				foreach ($list as $key => $value) {
					$url = "/index/show-exercises?url=".$value["url"];
					?>
					<div id=<?php echo "row".$value["id"] ?> class="components-news">
						<p class="title-news"><a href="<?php echo DOMAIN_INDEX ?>/subjects/submit-exercises?id=<?php echo $value["id"]; ?>&sj_id=<?php echo $sj_id; ?>"><?php echo $value["name"]; ?></a></p>
						<div class="short-content-news" style="">
							<?php echo "<span style='font-weight:bold;'>Nội dung: </span>".SubjectsModel::catchu(strip_tags($value["content"]),500); ?>
							<div style="clear:both"></div>
							<?php 
			                  echo "<p style='width:30%;float:left;'><span style='font-weight:bold;'>File đính kèm: </span>";
			                  if($value["link"]) echo "<a href='".DOMAIN.$value["link"]."'>File đính kèm</a></p>";
			                  else echo "Không có! </p>";  
			              ?>
						</div>
					</div>
					<div style="text-align:right;border-bottom: 1px dotted #ababab;">
	                  <span><a href="<?php echo DOMAIN_INDEX ?>/subjects/edit-ex?id_ex=<?php echo $value["id"] ?>">Chỉnh sửa</a></span>
	                  <span onclick="deleteEx(<?php echo $value["id"] ?>)">Xóa</span>
	              </div>
					<div class="clear"></div>
					<?php
				}
			}
	?>
	</section>
</div>